using System;
using System.Collections.Generic;
using System.Text;
using SchEdu.Framework.DataModel;
using SchEdu.Framework.Exceptions;

namespace SchEdu.Framework.Validators
{
    public class AllocationMachineValidator : Validator
    {
        public AllocationMachineValidator()
            : base()
        {
        }

        public AllocationMachineValidator(SchEduData schEduData, SchEduDataSet.SolutionRow solution)
            : base(schEduData,solution)
        {
        }
   
        #region IValidator Members

        public override void Validate()
        {
            AllocationList allocations = new AllocationList(Solution.GetAllocationRows());
            foreach (SchEduDataSet.AllocationRow allocation in allocations)
            {
                if (allocation.IsMachineIDNull() == true)
                {
                    throw new ValidatorException(string.Format(Resources.AllocationDoesNotHaveMachine, allocation.ID));
                }
            }
        }

        #endregion
    }
}
